package com.bs.resa.service.impl;


import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import javax.annotation.Resource;

import com.bs.resa.common.RedisUtils;
import com.bs.resa.dao.AdminUserMapper;
import com.bs.resa.pojo.AdminUser;
import com.bs.resa.service.AdminUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;


/**
* Copyright (C),2017, Guangzhou sys info. Co., Ltd.
* @ClassName: AdminUserService  
* @Description: 管理员用户管理Service 
* @author lao  
* @date 2018年1月3日上午9:54:56  
* @version 1.00
 */
@Service
public class AdminUserServiceImpl implements AdminUserService {

	@Resource
	AdminUserMapper adminUserMapper;
	@Resource
	RedisUtils redisUtils;
	Map<String,Long> map = new HashMap<String,Long>();

	/**
	* @Description: 登录认证
	* @param account
	* @param password
	* @return
	* @throws  
	* @author lao
	* @Date 2018年1月2日上午11:09:40
	* @version 1.00
	 */
	public AdminUser login(String account, String password) {
		AdminUser adminUser = new AdminUser();
		adminUser.setAccount(account);
		adminUser.setPassword(password);
//		System.out.println("service:" + account);
		AdminUser adminUser1 = adminUserMapper.login(adminUser);

		return adminUser1;
	}

	@Override
	public List<AdminUser> queryAll() {

		return adminUserMapper.queryAll();
	}

	@Override
	public List<AdminUser> queryByPid(String pid) {
		return adminUserMapper.queryUserByParticipant(pid);
	}



	/**
	 * @param userid
	 * @return
	 * @Description: 根据用户ID查询角色
	 */
	@Override
	public Set<String> findRoleByUserId(Long userid) {
		return adminUserMapper.findRoleByUserId(userid);
	}

	/**
	 * @param userid
	 * @return
	 * @Description: 根据用户ID查询权限
	 */
	@Override
	public Set<String> findPermissionByUserId(Long userid) {
		return adminUserMapper.findPermissionByUserId(userid);
	}

	/**
	 * 更加用户名查询用户id
	 *
	 * @param account
	 * @return
	 */
	@Override
	public AdminUser findByUserAccount(String account) {
		return adminUserMapper.findUserAccount(account);
	}


}
